test("Methods and Events",function(){
	
	expect( 18 );
	
	// stop method calls, count method calls, display element
	var suppress = true, called = 0, $box, 
	data = {}, top, left, height, width,
	// the instance to manipulate
	$div = jQuery('<div></div>')
		.blackbox({
			showEvent: "klick",
			html: function(){ 
				if ( suppress ) return false;
				called += 1; 
				$box = arguments[ 0 ];
				return "Hello";
				}
			})
		.bind("beforeshow:blackbox",data,function(){
			if ( suppress ) return false;
			called += 1; 
			})
		.bind("show:blackbox",data,function(){
			called += 1; 
			})
		.bind("beforehide:blackbox",data,function(){
			if ( suppress ) return false;
			called += 1; 
			})
		.bind("hide:blackbox",data,function(){
			called += 1; 
			})
		.bind("size:blackbox",data,function(){
			data.width = $box.width();
			data.height = $box.height();
			called += 1; 
			})
		.bind("align:blackbox",data,function(){
			$.extend( data, $box.offset() );
			called += 1; 
			});
	
	// prevent html
	suppress = true;
	// exposed show method
	$div.ux("blackbox.show");
/*** check that nothing was called ***/
	equals( called, 0, 'html option return false' );

	// allow html
	suppress = false;
	// exposed show method
	$div.ux("blackbox.show");
/*** check that five functions were called ***/
	equals( called, 5, 'html, before show, size, align, show' );
/*** did the html return content ***/
	equals( $box.text(), "Hello", 'html return content' );

	// prevent hiding
	suppress = true;
	// exposed hide method
	$div.ux("blackbox.hide");
/*** check that no functions were called ***/
	equals( called, 5, 'before hide return false' );
	
	// allow hiding
	suppress = false;
	// calculate some new values
	left = data.left - 11;
	top = data.top - 22;
	// exposed align method
	$div.ux("blackbox.align", left, top );
/*** check that one function was called ***/
	equals( called, 6, 'align' );
/*** check that the alignment function set the box position ***/
	equals( data.left, left, "align arg: left set" );
/*** check that the alignment function set the box position ***/ 
	equals( data.top, top, "align arg: top set" );
	
	// calculate some new values
	width = data.width + 33;
	height = data.height + 44;
	// exposed size method
	$div.ux("blackbox.size", width, height );
/*** check that two functions were called ***/
	equals( called, 8, 'size, align' );
/*** check that the size method set the box height ***/
	equals( data.height, height, "size arg: height set" );
/*** check that the size method set the box width ***/
	equals( data.width, width, "size arg: width set" );
	
	// exposed hide method
	$div.ux("blackbox.hide");
/*** check that two functions were called ***/
	equals( called, 10, 'before hide, hide' );
	
	// exposed disable method
	$div.ux("blackbox.disable");
/*** check that no functions were called ***/
	equals( called, 10, 'disabled' );
	
	// exposed enable and show methods
	$div.ux("blackbox.enable").ux("blackbox.show","<span> World</span>");
/*** check that four functions were called (no html) ***/
	equals( called, 14, 'enabled' );
/*** check that show takes an argument ***/
	equals( $box.text(), "Hello World", 'show arg: string appended' );
	
	// show new content with a function
	$div.ux("blackbox.show",function( $elem ){
		$elem.html("Goodnight Moon")
		});
/*** check that four functions were called ***/
	equals( called, 18, 'before show, size, align, show' );	
/*** check that show takes a function ***/
	equals( $box.text(), "Goodnight Moon", 'show arg: function executed' );	
	
	// exposed destroy method
	$div.ux("blackbox.destroy");
/*** check that hide callback functions called on destroy ***/
	equals( called, 20, 'hide before destroying' );
	
	// exposed show method, and show event
	$div.ux("blackbox.show").trigger("klick");
/*** instance does nothing.. ***/
	equals( called, 20, 'destroyed' );
	
	});